//
//  StartFaseController.m
//  NtoccDriverNew
//
//  Created by 张天兴 on 2025/7/4.
//  Copyright © 2025 GCY. All rights reserved.
//

#import "StartFaseController.h"
#import "ErrorFaseController.h"
#import "AutonymNameController.h"
#import "ErrorFaseController.h"

@interface StartFaseController ()
@property (nonatomic, strong) NSDictionary *dict;

@end

@implementation StartFaseController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = BackgroundColor;
    [self setTitle:@"人脸识别"];
    self.comittButton.layer.masksToBounds = YES;
    self.comittButton.layer.cornerRadius = 10;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationAction) name:@"shimingrenzhengAction" object:nil];
    // Do any additional setup after loading the view from its nib.
}
- (void)notificationAction{
    ErrorFaseController *vc = [[ErrorFaseController alloc] init];
    vc.dataDic = self.dict;
    vc.isOldStr = self.isOldType;
    vc.IDcodeTime = self.IDcodeTime;
    vc.address = self.address;
    [self.navigationController pushViewController:vc animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)startFaceButtonAction:(UIButton *)sender {
//    ErrorFaseController *vc = [[ErrorFaseController alloc] init];
//    [self.navigationController pushViewController:vc animated:YES];
    [self IDyanzhemgNetworking];
}
- (void)IDyanzhemgNetworking{
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    if ([self.isOldType isEqualToString:@"1"]) {
        [parmas setValue:[UserDefaultUtil valueForKey:USER_CODE] forKey:@"partyCode"];
        [parmas setValue:self.name forKey:@"name"];
        [parmas setValue:self.IDCod forKey:@"idNo"];
//        [parmas setValue:@"张耀" forKey:@"name"];
//        [parmas setValue:@"53040219900123001" forKey:@"idNo"];
        [parmas setValue:@"ESIGN" forKey:@"faceauthMode"];
        [parmas setValue:@"https://example.demo.cn:8080/notify/receive" forKey:@"callbackUrl"];

    }else{
        [parmas setValue:[UserDefaultUtil valueForKey:USER_CODE] forKey:@"partyCode"];
        [parmas setValue:self.name forKey:@"name"];
        [parmas setValue:self.IDCod forKey:@"idNo"];
//        [parmas setValue:@"张耀文" forKey:@"name"];
//        [parmas setValue:@"530402199001230019" forKey:@"idNo"];
        [parmas setValue:self.idnoFrontImg forKey:@"idnoFrontImg"];
        [parmas setValue:self.idnoBackImg forKey:@"idnoBackImg"];
        [parmas setValue:@"ESIGN" forKey:@"faceauthMode"];
        [parmas setValue:@"https://example.demo.cn:8080/notify/receive" forKey:@"callbackUrl"];
    }

    [HTTPManager postNetworkRequest:CJStringWithFormat(@"%@%@", [NSString stringWithFormat:@"%@/ntocc-basic-api",[ReAddressDynamic shared].baseUrl], AuthenticationIndividualFace) withParameter:parmas withVC:self netName:@"实名认证" success:^(id response, NSString *msg) {
        [XSInfoView showInfo:msg onView:self.view];
        if ([response[@"status"] intValue] == 0) {
            self.dict = response;
            AutonymNameController *vc = [[AutonymNameController alloc] init];
            vc.urlStr = response[@"originalUrl"];
            vc.DataDic = response;
            [self.navigationController pushViewController:vc animated:YES];
        }
        } failure:^(NSInteger code, NSString *msg) {
            
        }];
}
@end
